package com.lrd.shardingjdbc.mapper;

import com.lrd.shardingjdbc.entity.T_User;
import com.lrd.shardingjdbc.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author LRD
 * @create 2021-03-24 23:17
 */
@Mapper
public interface UserMapper {

    @Insert("insert into user(id,nick_name,pass_word,sex,birthday) values (#{id},#{nickName},#{passWord},#{sex},#{birthday})")
    void addUser(User user);

    @Insert("insert into t_user(nick_name,pass_word,age,sex,birthday) values (#{nickName},#{passWord},#{age},#{sex},#{birthday})")
    void addTUser(T_User user);

    @Select("select * from user")
    List<User> findAllUsers();

}
